var assert = require('assert');
var should = require('should');
var util = require('util');
var zlib = require('zlib');
var async = require('async');
var _ = require('lodash');
var enterHandler = require('../../../app/servers/copy/handler/enterHandler');
var config = require('../../config');
var PlayerManager = require('../../../app/libs/playerManager');

suite('测试copy.EnterHandler', function () {
    var player_manager = new PlayerManager(config.role_id);
    setup(function (done) {
        player_manager.getAllModel(function (err, model) {
            player_manager.role.addFood(10000);
            player_manager.save(function () {
                done();
            });
        });
    });

    suite('enter', function () {
        test('进入副本成功', function (done) {
            var msg = {};
            msg.copy_id = 10101;

            var session = {};
            session.uid = config.role_id;

            var enter_handler = new enterHandler();
            enter_handler.enter(msg, session, function (err, res) {
                // res.code.should.eql(200);
                done();
            });
        });

        test('进入副本成功', function (done) {
            var msg = {};
            msg.copy_id = 1;

            var session = {};
            session.uid = config.role_id;

            var enter_handler = new enterHandler();
            enter_handler.enter(msg, session, function (err, res) {
                // res.code.should.eql(200);
                done();
            });
        });

        test('进入副本成功', function (done) {
            var msg = {};
            msg.copy_id = 10102;

            var session = {};
            session.uid = config.role_id;

            var enter_handler = new enterHandler();
            enter_handler.enter(msg, session, function (err, res) {
                // res.code.should.eql(200);
                done();
            });
        });
    });

    suite('enter', function () {
        test('进入副本失败,返回600', function (done) {
            var msg = {};

            var session = {};
            session.uid = config.role_id;

            var enter_handler = new enterHandler();
            enter_handler.enter(msg, session, function (err, res) {
                // res.code.should.eql(600);
                done();
            });
        });
    });
});
